package com.hopes.bizz.close.gis.controller;

import com.hopes.bizz.close.gis.service.ClosedHazardService;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 危险品监管专题
 * @time 2024/2/26 18:11
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/hazard")
@Tag(description = "hazard", name = "封闭化管理一张图（危险品监管）")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ClosedHazardController {

    private final ClosedHazardService closedHazardService;

    @Operation(summary = "危险品车辆预约", description = "危险品车辆预约")
    @GetMapping("/apply")
    public R hazardApplyCount() {
        return R.ok(closedHazardService.queryHazardApplyCount());
    }

    @Operation(summary = "危险品车辆预约图表", description = "危险品车辆预约图表")
    @GetMapping("/apply/chart")
    public R hazardApplyCountChart(
            @RequestParam("beginTime")String beginTime, @RequestParam("endTime") String endTime) {
        return R.ok(closedHazardService.queryHazardApplyCountChart(beginTime, endTime));
    }

    @Operation(summary = "危险品车辆类型预约图表", description = "危险品车辆类型预约图表(包含更多页面接口)")
    @GetMapping("/apply/car/chart")
    public R hazardApplyCarTypeChart(
            @RequestParam(value = "beginTime", required = false)String beginTime, @RequestParam(value = "endTime", required = false) String endTime) {
        return R.ok(closedHazardService.queryHazardApplyCarType(beginTime, endTime));
    }


    @Operation(summary = "危险品预约目标企业统计图表", description = "危险品预约目标企业统计图表(包含更多页面接口)")
    @GetMapping("/apply/company/chart")
    public R hazardApplyCompanyChart(
            @RequestParam(value = "beginTime", required = false)String beginTime, @RequestParam(value = "endTime", required = false) String endTime) {
        return R.ok(closedHazardService.queryHazardApplyCompanyChart(beginTime, endTime));
    }

}
